﻿using System;
using System.Linq;
using System.Xml.Linq;
using System.Collections.Generic;

namespace CodeCounsel.SharePoint.RibbonDesigner.Model
{
    [XName("Section", Namespaces.CommandUIText)]
    public class Section
        : DomainElement
    {
        public SectionType Type
        {
            get { return DataModel.GetAttributeValue<SectionType>(Schema.Type); }
            set { DataModel.SetAttributeValue<SectionType>(Schema.Type, value); }
        }

        public Alignment Alignment
        {
            get { return DataModel.GetAttributeValue<Alignment>(Schema.Alignment, Alignment.Top); }
            set { DataModel.SetAttributeValue<Alignment>(Schema.Alignment, value); }
        }

        public IEnumerable<Row> Rows
        {
            get { return Children.OfType<Row>(); }
        }

        public Section(XElement dataModel, DomainModelSource source)
            : base(dataModel, source)
        {
        }

        public Section()
        {
        }
    }
}
    